package com.goods.service;

import com.goods.entity.GoodsEntityPK;
import com.goods.entity.goods;
import com.goods.dao.goodsDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class goodsServiceImpl implements goodsService{

    @Autowired
    private goodsDao goodsdao;

    @Override
    public goods create(goods g) {
       return goodsdao.save(g);
    }
    @Override
    public void delete(goods g) {
        goodsdao.delete(g);
    }
    @Override
    public goods update(goods g) {
        return goodsdao.save(g);
    }

    @Override
    public goods findOne(Integer gid) {
        return goodsdao.findById(gid).orElse(null);
    }

    @Override
    public List<goods> findAll() {
        return goodsdao.findAll();
    }
}
